package com.shop.shoppingmall.service.impl;

import com.shop.shoppingmall.dao.ShOrderAllDao;
import com.shop.shoppingmall.entity.ShOrderAll;
import com.shop.shoppingmall.service.ShOrderAllService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (ShOrderAll)表服务实现类
 *
 * @author makejava
 * @since 2020-11-13 16:48:06
 */
@Service("shOrderAllService")
public class ShOrderAllServiceImpl implements ShOrderAllService {
    @Resource
    private ShOrderAllDao shOrderAllDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ShOrderAll queryById(String id) {
        return this.shOrderAllDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param shOrderAll 实例对象
     * @return 实例对象
     */
    @Override
    public ShOrderAll insert(ShOrderAll shOrderAll) {
        this.shOrderAllDao.insert(shOrderAll);
        return shOrderAll;
    }

    /**
     * 修改数据
     *
     * @param shOrderAll 实例对象
     * @return 实例对象
     */
    @Override
    public ShOrderAll update(ShOrderAll shOrderAll) {
        this.shOrderAllDao.update(shOrderAll);
        return this.queryById(shOrderAll.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.shOrderAllDao.deleteById(id) > 0;
    }
}